|
Registering a component in the script system
To refer to our component from the script, it is necessary to register its class, its properties, and methods in the script system. The register code, according to the agreement accepted in FastReport, may be placed in a file with a name similar to the name of the file with the component's code, adding the RTTI suffix (for example, frxBitBtnRTTI.pas in our case). See more about registration of classes, their methods and properties in the FastScript script library's documentation. uses fs_iinterpreter, frxBitBtn, frxClassRTTI; type public destructor Destroy; override; end; var constructor TFunctions.Create; begin { of all classes, methods, types, variables etc. are registered in the script system } with fsGlobalUnit do begin { register a class, and then define its parent } AddClass(TfrxBitBtnControl, 'TfrxDialogControl'); { if there are several common controls in your unit, they can be registered right here } { for example, AddClass(TfrxAnotherControl, 'TfrxDialogControl'); } AddedBy := nil ; end; end; destructor TFunctions.Destroy; begin inherited; end; initialization finalization end. |